/*
*  cbtable.h - Callback hashtable functions
*  Copyright (c) 2005 Derek Ingrouville (dergro@users.sourceforge.net)
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Library General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef _CBTABLE_H
#define _CBTABLE_H

#include <glib.h>
#include "command.h"

typedef int (*MsnCallback)(gpointer data, gpointer user_data);

typedef struct _MsnCallbacks
{
    GHashTable *cmd_callbacks;
    GHashTable *msg_callbacks;
    GHashTable *error_callbacks;
    GHashTable *event_callbacks;
    gpointer cmd_data;
	gpointer event_data;
} MsnCallbacks;

MsnCallbacks *msn_callbacks_new (void);
void msn_callbacks_free (MsnCallbacks *msncbs);

void msn_callbacks_add_cmd (MsnCallbacks *msncbs, char *cmd, gpointer cb);
void msn_callbacks_add_msg (MsnCallbacks *msncbs, char *content_type, gpointer cb);
void msn_callbacks_add_error (MsnCallbacks *msncbs, char *error, gpointer cb);
void msn_callbacks_add_event (MsnCallbacks *msncbs, char *event_name, gpointer cb);

void msn_callbacks_set_cmd_data (MsnCallbacks *msncbs, gpointer data);
void msn_callbacks_set_event_data (MsnCallbacks *msncbs, gpointer data);

MsnCallback msn_callbacks_lookup (MsnCallbacks *msncbs, char *key);

#endif /* _CBTABLE_H */

